package com.sais.manage.boot.platform.config;

import com.sais.common.entity.Result;
import org.apache.shiro.web.filter.authc.UserFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * 宿舍管理系统-用户登录拦截
 *
 * @author zhang
 * @date 2019/12/3
 **/
public class ShiroFilter extends UserFilter {

    @Override
    protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException {
        response.setContentType("application/json; charset=utf-8");
        response.getWriter().print(Result.response(Result.CODE_401, "请登录"));

    }
}
